<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib uri="/WEB-INF/page-base.tld" prefix="p"%>

<%String path=request.getContextPath(); %>
<script>
function rank_rankaddok(){
	var nodes=$("#rankgroup_tree").dynatree("getTree").getSelectedNodes();
    var nodestr="";
	for(i=0;i<nodes.length;i++){
		if(nodestr!="")
			nodestr+=","+nodes[i].data.key;
		else
			nodestr+=nodes[i].data.key;
	}
	$getByName("menuIds",$w.currWinForm()).val(nodestr);
	return $w.doWinForm(function(re){
		if(re.state=='addok'){
			$w.correctMsg("添加成功！");
			$w.listFlesh=true;
			$w.closeCurrWin();
		}else if(re.state=='updateok'){
			$w.correctMsg("修改成功！");
			$w.listFlesh=true;
			$w.closeCurrWin();
		}
	});
}

</script>
<div class="easyui-panel" data-options="doSize:false,layoutH:47,border:false" style="margin:5px">
		<form method="post" action="/platform/rank/RankPage.page">
			<p:hidden bind="bean.rankid"/>
			<p:hidden bind="actions"/>
			<p:hidden bind="menuIds"/>
			<div class="ui-formContent">
				<p>
					<label style="width:80px">权限名称：</label>
					<p:text bind="bean.rankname" style="width:210px" styleClass="easyui-validatebox" dataOptions="required:true"/>
				</p>
				<!--  
				<p>
					<label style="width:80px">权限编码：</label>
					<p:text bind="bean.rankcode" style="width:210px"/>
				</p>
				-->
				<p>
					<label style="width:80px">权限描述：</label>
					<p:text bind="bean.rankdesc" style="width:210px"/>
				</p>
				<div>
					<FIELDSET align=center style="width:92%;">
			        <LEGEND align=left><b>权限菜单</b></LEGEND>
			        <div id="rankgroup_tree" style="background:#ffffff;text-align:left;height:250px;overflow:auto"></div>
			   		</FIELDSET>
				</div>
	</div>
</form>
</div>
<div class="ui-buttonBar">
	<a href="javascript:;" class="easyui-linkbutton" iconCls="icon_save" onclick="rank_rankaddok()">保 存</a>
	<a href="javascript:;" class="easyui-linkbutton" iconCls="icon_cancel" onclick="$w.closeCurrWin()">取 消</a>
</div>
<script>

 $("#rankgroup_tree").dynatree({
	rootVisible: false,
	checkbox: true,
	selectMode: 3,
	initAjax: { 
              url: ctx+"/platform/menu/MenuTreeShowJson.json?rankId="+$getByName("bean.rankid",$w.currWinForm()).val()
		}
});
</script>